package com.resttest.ljs.controller;

import com.resttest.ljs.config.PdfUtils;
import com.resttest.ljs.config.RabbitSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.File;

@Controller
public class RabbitProducer {
    @Autowired
    private RabbitSender rabbitSender;

    @PostMapping("/rabbitsend")
    @ResponseBody
    public String send(@RequestBody String body) throws Exception {
        String a ="";
        for (int i = 0; i < 10; i++) {
            rabbitSender.sendSomething("Exchange-test","ceshi","i");
        }
        return a;
    }

    public static void main(String[] args) {
        String source = "D:\\Backup\\Documents\\My Pictures\\123.jpg";
        String target = "D:\\Backup\\Documents\\My Pictures\\234.pdf";
        PdfUtils.convert(source, target);
    }
}
